include( 'shared.lua' )

SWEP.PrintName            = "Minecraft Block";
SWEP.Slot                = 3;
SWEP.SlotPos            = 1;
SWEP.WepSelectIcon = surface.GetTextureID("VGUI/entities/minecraft_swep");
SWEP.BounceWeaponIcon = true;
SWEP.DrawAmmo            = false;
SWEP.DrawCrosshair        = true;

CreateClientConVar( "cl_minecraft_maxspawndist", "270", false, true )  
CreateClientConVar( "cl_minecraft_deletemconly", "1", false, true )  
CreateClientConVar( "cl_minecraft_lavaigniteplayer", "0", false, true )
CreateClientConVar( "cl_minecraft_lavaigniteblocks", "0", false, true )
CreateClientConVar( "cl_minecraft_blocktype", "21", false, true )      
CreateClientConVar( "cl_minecraft_disablesounds", "0", false, true )  
CreateClientConVar( "cl_minecraft_distancelimit", "0", false, true )  
CreateClientConVar( "cl_minecraft_blockhealth", "101", false, true )  
CreateClientConVar( "cl_minecraft_spawntype", "2", false, true )	     
CreateClientConVar( "cl_minecraft_swapattack", "0", false, true )
CreateClientConVar( "cl_minecraft_remove", "0", false, true )   
CreateClientConVar( "cl_minecraft_z_blockcount", "0", false, true ) 
CreateClientConVar( "cl_minecraft_playerfix", "0", false, true )

local function PlayerFix(CVar, PreviousValue, NewValue)
	LocalPlayer():ConCommand("minecraft_getcurplayer "..tostring(GetConVar("cl_minecraft_playerfix"):GetInt()))
end
cvars.AddChangeCallback("cl_minecraft_playerfix", PlayerFix)

local function RemoveCallback(CVar, PreviousValue, NewValue)
	LocalPlayer():ConCommand("minecraft_getplayer "..tostring(GetConVar("cl_minecraft_remove"):GetInt()))
end
cvars.AddChangeCallback("cl_minecraft_remove", RemoveCallback)

local function CountCallback(CVar, PreviousValue, NewValue)
	LocalPlayer():ConCommand("minecraft_getblockcount "..tostring(GetConVar("cl_minecraft_z_blockcount"):GetInt()))
end
cvars.AddChangeCallback("cl_minecraft_z_blockcount", CountCallback)


local function LavaPCallback(CVar, PreviousValue, NewValue)
	LocalPlayer():ConCommand("minecraft_lavap "..tostring(GetConVar("cl_minecraft_lavaigniteplayer"):GetInt()))
end
cvars.AddChangeCallback("cl_minecraft_lavaigniteplayer", LavaPCallback)

local function LavaBCallback(CVar, PreviousValue, NewValue)
	LocalPlayer():ConCommand("minecraft_lavab "..tostring(GetConVar("cl_minecraft_lavaigniteblocks"):GetInt()))
end
cvars.AddChangeCallback("cl_minecraft_lavaigniteblocks", LavaBCallback)
